extends CardState

func enter()->void:
	if state != State.BASE:return push_error('状态未分配')
	if !card.is_node_ready():await card.ready
	# 终止动画
	if card.tween and card.tween.is_running():card.tween.kill()

	# 设置卡牌样式
	setStyle(card.BASE)
	# 加入手牌
	card.joinHand.emit(card)
	# 重置旋转中心
	card.pivot_offset=Vector2.ZERO

func onGuiInput(event:InputEvent)->void:
	if !card.playabel or card.disable:return
	if event.is_action_pressed('left_mouse'):
		card.pivot_offset=card.get_global_mouse_position()-card.global_position
		transition.emit(self,State.CLICKED)

func onMouseEntered()->void:
	if !card.playabel or card.disable:return
	setStyle(card.HOVER)

func onMouseExited()->void:
	if !card.playabel or card.disable:return
	setStyle(card.BASE)
	